package com.levy.contronller.jvm.classLoader;

/**
 * Created by levy on 2019/6/4.
 */
public class MyTest18 {

    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
        MyClassLoader loader1 = new MyClassLoader("loader1");
        Class<?> aClass = loader1.loadClass("com.levy.contronller.jvm.classLoader.MySample");
        System.out.println(aClass.getClassLoader());
        System.out.println("class: " + aClass.hashCode());

        //如果注释掉该行，那么并不会实例化MySample对象，即其构造方法也不会被调用
        //因此不会实例化myCat对象，即没有对myCat进行主动使用，所以不会加载myCat.class
        Object o = aClass.newInstance();

    }
}
